// eslint-disable-next-line
import { MainLayout, MapLayout, UserLayout, BasicLayout, RouteView, BlankLayout, PageView } from '@/layouts'
import { bxAnaalyse } from '@/core/icons'

export const asyncRouterMap = [
  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: '首页' },
    redirect: '/dashboard/workplace',
    children: [
      // dashboard
      {
        path: 'dashboard',
        name: 'dashboard',
        redirect: '/dashboard/workplace',
        component: RouteView,
        meta: { title: '仪表盘', keepAlive: true, icon: bxAnaalyse, permission: ['dashboard'] },
        children: [
          {
            path: 'analysis/:pageNo([1-9]\\d*)?',
            name: 'Analysis',
            component: () => import('@/views/dashboard/Analysis'),
            meta: { title: '分析页', keepAlive: false, permission: ['dashboard'] }
          },
          // 外部链接
          {
            path: 'https://www.baidu.com/',
            name: 'Monitor',
            meta: { title: '监控页（外部）', target: '_blank' }
          },
          {
            path: 'workplace',
            name: 'Workplace',
            component: () => import('@/views/dashboard/Workplace'),
            meta: { title: '工作台', keepAlive: true, permission: ['dashboard'] }
          },
          {
            path: 'test-work',
            name: 'TestWork',
            component: () => import('@/views/dashboard/TestWork'),
            meta: { title: '测试功能', keepAlive: true, permission: ['dashboard'] }
          }
        ]
      },
      {
        name: '地图',
        component: MapLayout,
        path: '/map',
        redirect: '/gis/map',
        meta: { title: '大屏地图', keepAlive: true, icon: 'global', permission: ['gis'] }
      },
      {
        name: 'ArcGis',
        component: MainLayout,
        path: '/ArcGis',
        redirect: '/webGl/ArcGis',
        meta: { title: 'ArcGis', keepAlive: true, icon: 'global', permission: ['webGl'] }
        // children: [
        //   {
        //     name: 'ArcGis',
        //     path: '/webGl/ArcGis',
        //     component: () => import('@/views/webGl/ArcGis/index'),
        //     meta: { title: 'ArcGis', keepAlive: false, permission: [ 'webGl' ] }
        //   },
        //   // {
        //   //   name: 'OpenLayers',
        //   //   path: '/webGl/OpenLayers',
        //   //   component: () => import('@/views/webGl/OpenLayers/index'),
        //   //   meta: { title: '插值分析图', keepAlive: false, permission: [ 'webGl' ] }
        //   // }
        // ]
      },
      {
        name: '高德',
        component: MainLayout,
        path: '/amap',
        redirect: '/webGl/amap',
        meta: { title: '高德', keepAlive: true, icon: 'global', permission: ['webGl'] }
      },
      {
        name: 'olMap',
        component: MainLayout,
        path: '/olMap',
        redirect: '/webGl/olMap',
        meta: { title: 'olMap', keepAlive: true, icon: 'global', permission: ['webGl'] }
      },
      {
        name: 'Cesium',
        component: MainLayout,
        path: '/Cesium',
        redirect: '/webGl/Cesium',
        meta: { title: 'cesium', keepAlive: true, icon: 'global', permission: ['webGl'] }
      },

      {
        name: 'geometry',
        component: PageView,
        path: '/geometry',
        redirect: '/geometry/project',
        meta: { title: '地理工具', keepAlive: true, icon: 'tool', permission: ['table'] },
        children: [
          {
            name: 'Project',
            path: '/geometry/Project',
            component: () => import('@/views/geometry/Project'),
            meta: { title: '坐标投影', keepAlive: false, permission: ['table'] }
          }
          // {
          //   name: 'OpenLayers',
          //   path: '/webGl/OpenLayers',
          //   component: () => import('@/views/webGl/OpenLayers/index'),
          //   meta: { title: '插值分析图', keepAlive: false, permission: [ 'webGl' ] }
          // }
        ]
      },
      // list
      {
        path: '/list',
        name: 'list',
        component: PageView,
        redirect: '/list/table-list',
        meta: { title: 'Excel处理', icon: 'table', permission: ['table'] },
        children: [
          {
            path: '/list/card',
            name: 'CardList',
            component: () => import('@/views/list/CardList'),
            meta: { title: '卡片列表', keepAlive: true, permission: ['table'] }
          }
        ]
      }
    ]
  },
  {
    name: 'webGl',
    component: MainLayout,
    path: '/webGl',
    redirect: '/webGl/Cesium',
    meta: { title: '地图', keepAlive: true, icon: 'global', permission: ['webGl'] },
    children: [
      {
        name: 'ArcGis',
        path: '/webGl/ArcGis',
        component: () => import('@/views/webGl/ArcGis/index'),
        meta: { title: 'ArcGis', keepAlive: true, permission: ['webGl'] }
      },
      {
        name: '高德地图',
        path: '/webGl/amap',
        component: () => import('@/views/webGl/AMap/index'),
        meta: { title: 'amap', keepAlive: false, permission: ['webGl'] }
      },
      {
        name: 'Cesium',
        path: '/webGl/Cesium',
        component: () => import('@/views/webGl/Cesium/index'),
        meta: { title: 'cesium', keepAlive: false, permission: ['webGl'] }
      },
      {
        name: 'olMap',
        path: '/webGl/olMap',
        component: () => import('@/views/webGl/OpenLayers/index'),
        meta: { title: 'olMap', keepAlive: false, permission: ['webGl'] }
      },
      {
        name: '天地图',
        path: '/webGl/TDTLayer',
        component: () => import('@/views/webGl/TDTLayer'),
        meta: { title: 'TDT', keepAlive: false, permission: ['webGl'] }
      }
      // {
      //   name: '坐标投影',
      //   path: '/webGl/Project',
      //   component: () => import('@/views/webGl/Project'),
      //   meta: { title: 'Project', keepAlive: false, permission: [ 'webGl' ] }
      // },
      // {
      //   name: 'OpenLayers',
      //   path: '/webGl/OpenLayers',
      //   component: () => import('@/views/webGl/OpenLayers/index'),
      //   meta: { title: '插值分析图', keepAlive: false, permission: [ 'webGl' ] }
      // }
    ]
  },
  {
    name: 'gis',
    component: MapLayout,
    path: '/gis',
    redirect: '/gis/map',
    meta: { title: '地图', keepAlive: true, icon: 'global', permission: ['gis'] },
    children: [
      {
        name: 'mark',
        path: '/gis/map',
        component: () => import('@/views/gis/map/MarkList'),
        meta: { title: 'map', keepAlive: true, permission: ['gis'] }
      }
    ]
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user',
    component: UserLayout,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
      },
      {
        path: 'register',
        name: 'register',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Register')
      },
      {
        path: 'register-result',
        name: 'registerResult',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/RegisterResult')
      },
      {
        path: 'recover',
        name: 'recover',
        component: undefined
      }
    ]
  },

  {
    path: '/test',
    component: BlankLayout,
    redirect: '/test/home',
    children: [
      {
        path: 'home',
        name: 'TestHome',
        component: () => import('@/views/Home')
      }
    ]
  },

  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  }
]
